package com.home.biz;

import com.google.protobuf.ServiceException;
import com.home.base.biz.BaseBiz;
import com.home.entity.MsgSendInfo;
import com.home.mapper.MsgSendInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class MsgSendInfoBiz extends BaseBiz<MsgSendInfoMapper, MsgSendInfo> {
    @Transactional(rollbackFor = Exception.class)
    public void insertInfo(String message) throws ServiceException{

        insert(MsgSendInfo.builder().msgBody(message).build());
        if(message.indexOf("3")>0){
            System.out.println("==============="+message);
            throw new ServiceException("3 is not allowed");
        }
    }
}
